package com.hero.zara.biz.taobao;

import com.taobao.api.ApiException;
import com.taobao.api.TaobaoClient;
import com.taobao.api.domain.User;
import com.taobao.api.request.UserGetRequest;
import com.taobao.api.response.UserGetResponse;

/**
 * TB用户
 * 
 * @author zxz
 */
public class TaobaoService {
	private TaobaoClient taobaoClient;

	public void setTaobaoClient(TaobaoClient taobaoClient) {
		this.taobaoClient = taobaoClient;
	}

	/**
	 * 获得用户信息
	 * 
	 * @return
	 * @throws ApiException
	 */
	public User getUser(String nick) throws ApiException {
		UserGetRequest req = new UserGetRequest();
		req.setFields("user_id,uid,nick,created");
		req.setNick(nick);
		UserGetResponse response = taobaoClient.execute(req);
		return response.getUser();
	}
}
